namespace 第三次作业
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "(*.cs) | *.cs";
            openFileDialog1.Title = "请选择文件";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = openFileDialog1.FileName;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            formatting formatting = new formatting();
            formatting.format(textBox1.Text);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            statistics statistics = new statistics();
            statistics.location = textBox1.Text;
            statistics.dostatistic();
            MessageBox.Show("行数：" + statistics.lineCount +"\r\n"+ "单词数：" + statistics.wordCount);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            statistics statistics = new statistics();
            statistics.location = textBox1.Text;
            Dictionary<string, int> keyValuePairs = new Dictionary<string, int>();
            keyValuePairs = statistics.dostatisticpro();
            Form2 form2 = new Form2(keyValuePairs);
            form2.ShowDialog();
        }
    }
}